<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.util.Constants,com.hs.core.utils.*" pageEncoding="UTF-8"%>
<%@ page import ="cn.ac.cintcm.dataconverge.researchsubject.domain.*,cn.ac.cintcm.dataconverge.util.*,cn.ac.cintcm.dataconverge.researcher.domain.Researcher" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String imagePath = basePath + "index/";
Subject obj = (Subject)request.getAttribute("subjectObj");
List docList = (List)request.getAttribute("docList");
boolean isAdmin = AuthCheck.isInGroup(request,Constants.SYSTEM_MANAGER);
boolean isOrgLeader = AuthCheck.isInGroup(request,Constants.ORG_LEADER);
boolean fileAuth = false;
if((null != obj && Constants.IS_PUBLIC.equals(obj.getPublicFlag()+""))||isAdmin || isOrgLeader)
		fileAuth = true;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title><%=Constants.APP_TITLE %>--<%=obj.getSubjectname() %>></title>
    <script language="javascript" src="<%=path %>/index/Scripts/script.js"></script>
	<script language="javascript" src="<%=path %>/js/common.js"></script>
	<link href="<%=path %>/index/Themes/com/style.css" type="text/css" rel="stylesheet"></link>
	<script src='<%=basePath%>dwr/engine.js'></script>
     <script src='<%=basePath%>dwr/util.js'></script> 
     <script src='<%=basePath%>dwr/interface/subject.js'></script>   
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page"> 
  </head>
 <script type="text/javascript">
 var fid = '';
 function download(fileId){
     fid = fileId;
     subject.isdownLoad(fileId,downCallBack);
 }
 function downCallBack(message){
    if(message == '0'){
       openwindow('<%=path %>/document.htm?action=downloadFile&fileId='+fid,'1','1','');
    }else{
       alert("本课题文档不公开，参与人员不能下载课题文档");
    }
 }
 </script>
<body class="idt_body" scroll="yes">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" id="Table5">
        <tr>
            <td class="idt_top_l">
            </td>
            <td class="idt_top_m">
                <!------------------ 标题栏 ------------------>
                <table width="100%" cellpadding="0" cellspacing="0" class="idt_hdr_mg" id="Table10"
                    border="0">
                    <tr>
                        <td class="idt_hdr_l">
                        </td>
                        <td>
                            <table border="0" cellpadding="0" cellspacing="0" class="idt_hdr_f" style="width: 100%;
                                text-align: center">
                                <tr>
                                    <td>
                                        课题信息</td>
                                </tr>
                            </table>
                        </td>
                        <td class="idt_hdr_td_r">
                        </td>
                        <td class="idt_hdr_r" style="width: 75%;">
                            <!------------------ 工具栏 ------------------>
                            <div style="text-align: right">
                                <table class="idt_tb_mg" id="Table3" cellspacing="0" cellpadding="0" width="*" border="0">
                                    <tr class="idt_tb_m">
                                        <td class="idt_tb_i">
                                            <img src="<%=imagePath%>Themes/com/idt_tb_close.gif"></td>
                                        <td class="idt_tb_f">
                                            <a href="javascript:window.close();">&nbsp;关闭&nbsp;</a></td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
                <!-----------------END- 标题栏 ------------------>
            </td>
            <td class="idt_top_r">
            </td>
        </tr>
    </table>
    <table cellpadding="0" cellspacing="0" width="100%" height="100%" id="Table8"  border="0">
        <tr>
            <td height="100%" style="padding-top: 3px;">
                <div id="navDiv10">
                    <table width="100%" height="100%" border="0"  cellpadding="0" cellspacing="0" id="Table11">
                        <tr valign="top">
                            <td class="idt_main_m">
                                <table class="idt_tle_mg" cellspacing="0" border="0" cellpadding="0" width="100%">
                                    <tr>
                                        <td class="idt_tle_i">
                                            <img id="imgForm6" src="<%=imagePath%>Themes/com/idt_tle_o.gif"></td>
                                        <td class="idt_tle_f1">
                                            基本信息</td>
                                    </tr>
                                </table>
                                <!--- 内容 --->
                                <div id="tdForm">
                                    <table border="0" cellpadding="0" cellspacing="1" width="100%" class="com_fieldset_tab">
                                        <tr>
                                            <td class="fim_l" width="15%">
                                                课题名称</td>
                                            <td class="fim_r" colspan="3" width="35%">
                                                <%=obj.getSubjectname() %></td>
                                            <td class="fim_l" width="15%">
                                                课题英文名称</td>
                                            <td class="fim_r" colspan="3">
                                                <%=StringUtilTool.NULL2Blank(obj.getSubjectnameEn()) %></td>  
                                        </tr> 
                                        <tr>
                                            <td class="fim_l">
                                                项目名称</td>
                                            <td class="fim_r" colspan="3">
                                                <%=StringUtilTool.NULL2Blank(obj.getProjectname())%></td>
                                            <td class="fim_l">
                                               课题编号</td>
                                            <td class="fim_r" colspan="3">
                                                <%=StringUtilTool.NULL2Blank(obj.getSnumber()) %></td>  
                                        </tr> 
                                        <tr>
                                            <td class="fim_l">
                                                主题词</td>
                                            <td class="fim_r" colspan="3">
                                                <%=StringUtilTool.NULL2Blank(obj.getTheme())%></td>
                                             <td class="fim_l">
                                               课题状态</td>
                                            <td class="fim_r" colspan="3">
                                              <%=Constants.getSubjectStatus(obj.getState()) %>
                                             </td>  
                                        </tr> 
                                         <tr>
                                            <td class="fim_l">
                                                课题来源</td>
                                            <td class="fim_r" colspan="3">
                                                <%
                                                Set set = obj.getTags();
                                                SubTag st1 = null;
                                                SubTag st2 = null;
                                                SubTag st3 = null;
                                                SubTag st4 = null;
                                                if(null != set){
                                                	Iterator iter = set.iterator();
                                                	while(iter.hasNext()){
                                                		 SubTag t = (SubTag)iter.next();
                                                		 if(null != t && t.getTag() != null){
                                                			 Tag tag = t.getTag();
                                                			 if(Constants.SUBJECT_FROM.equals(tag.getTagType()+""))
                                                				 st1 = t;
                                                			 if(Constants.SUBJECT_STUDY.equals(tag.getTagType()+""))
                                                				 st2 = t;
                                                			 if(Constants.SUBJECT_FORWARD.equals(tag.getTagType()+""))
                                                				 st3 = t;
                                                			 if(Constants.SUBJECT_PROP.equals(tag.getTagType()+""))
                                                				 st4 = t;
                                                		 }
                                                	}
                                                }
                                                
                                                %>
                                                <%=st1==null?"":st1.getTag().getName() %>
                                                </td>
                                            <td class="fim_l">
                                                学科分级</td>
                                            <td class="fim_r" colspan="3">
                                                 <%=st2==null?"":st2.getTag().getName() %></td>
                                            
                                        </tr> 
                                         <tr>
                                            <td class="fim_l">
                                                研究方向</td>
                                            <td class="fim_r" colspan="3">
                                                <%=st3==null?"":st3.getTag().getName() %></td>
                                                <td class="fim_l">
                                                研究属性</td>
                                            <td class="fim_r" colspan="3">
                                                <%=st4==null?"":st4.getTag().getName() %></td> 
                                        </tr> 
                                        <tr>
                                            <td class="fim_l">
                                                申请时间</td>
                                            <td class="fim_r"  colspan="3">
                                                <%=Tools.getDateStringByDate1(obj.getApplydate()) %></td>
                                                <td class="fim_l">
                                                中标时间</td>
                                            <td class="fim_r" colspan="3">
                                                <%=Tools.getDateStringByDate1(obj.getPermitdate()) %></td> 
                                        </tr> 
                                        <tr> 
                                                 <td class="fim_l">
                                                计划开始时间</td>
                                            <td class="fim_r" colspan="3">
                                               <%=Tools.getDateStringByDate1(obj.getStartdate()) %></td>
                                                <td class="fim_l">
                                                计划结束时间</td>
                                            <td class="fim_r" colspan="3">
                                                <%=Tools.getDateStringByDate1(obj.getEnddate()) %></td> 
                                        </tr> 
                                        <tr> 
                                                 <td class="fim_l">
                                                申请经费</td>
                                            <td class="fim_r" colspan="3">
                                               <%=StringUtilTool.setObjNULLStr(obj.getApplyfund()) %></td>
                                                <td class="fim_l">
                                                中标经费</td>
                                            <td class="fim_r" colspan="3">
                                                <%=StringUtilTool.setObjNULLStr(obj.getPermitfund()) %></td> 
                                        </tr> 
                                        <tr> 
                                                 <td class="fim_l">
                                                实获经费</td>
                                            <td class="fim_r" colspan="3">
                                               <%=StringUtilTool.setObjNULLStr(obj.getActualfund()) %></td>
                                                <td class="fim_l">
                                                所属年份</td>
                                            <td class="fim_r" colspan="3">
                                                <%=obj.getBelongyear()%></td> 
                                        </tr> 
                                        <tr> 
                                                 <td class="fim_l">
                                                课题概述</td>
                                            <td class="fim_r" colspan="7">
                                               <%=StringUtilTool.NULL2Blank(obj.getAbstractContent()) %></td>
                                               
                                                
                                        </tr> 
                                    </table>
                                    <table cellspacing="0" cellpadding="0" width="100%" class="idt_bottom_mg" border="0">
                                        <tr>
                                            <td align="right">&quot; 
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                               
                                <!--- 标题 ---->
                                <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                    <tr>
                                        <td class="idt_tle_i">
                                            <img id="img1" src="<%=imagePath%>Themes/com/idt_tle_o.gif"></td>
                                        <td class="idt_tle_f1">单位信息</td>
                                    </tr>
                                </table>
                                <!--- 内容 --->
                                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                    <tr>
                                        <td>
                                            <div class="content">
                                                <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4">
                                                    <tr>
                                                        <td class="dg_headerstyle" width="5%" >
                                                            序号</td>
                                                        <td class="dg_headerstyle">
                                                            单位名称</td>
                                                        <td class="dg_headerstyle">
                                                            单位角色</td> 
                                                    </tr>
                                                     <%  Set unitSet = obj.getSubOrg();  
                                                        if(unitSet != null && unitSet.size()>0){  
                                                   			Iterator iterUnit = unitSet.iterator();
                                                   			int i = 0;
                                                   			while(iterUnit.hasNext()){
                                                   				
                                                   				SubOrg org = (SubOrg)iterUnit.next();
                                                   				if(null == org.getOrg()){
                                                   					continue;
                                              	
                                                   				}
                                                   				i++;
                                                    
                                                     %>
                                                    <tr class="dg_alternatingitemstyle">
                                                        <td align="center">
                                                            <%=i %></td>
                                                        <td>
                                                           <%=org.getOrg()==null?"":org.getOrg().getName() %>
                                                        </td>
                                                        <td>
                                                           <%
								                                if(Constants.org_role_leader.equals(org.getOrgRole()))
								                                	out.print("牵头单位");
								                                if(Constants.org_role_participant.equals(org.getOrgRole()))
								                                	out.print("参与单位");
	                                
	                                						%>
                                                            
                                                        </td> 
                                                    </tr>
                                                    <%}}else{ %>
                                                    <tr class="dg_alternatingitemstyle">
                                                        <td align="center" colspan="3">
                                                        <font color=red>该课题当前没有单位信息</font> 
                                                         </td>  
                                                    </tr>
                                                    <%} %>
                                                </table>
                                                
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                                <!--- 标题 ---->
                                <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                    <tr>
                                        <td class="idt_tle_i">
                                            <img id="img1" src="<%=imagePath%>Themes/com/idt_tle_o.gif"></td>
                                        <td class="idt_tle_f1">人员信息</td>
                                    </tr>
                                </table>
                                <!--- 内容 --->
                                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                    <tr>
                                        <td>
                                            <div class="content">
                                                <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4">
                                                    <tr>
                                                        <td class="dg_headerstyle" width="5%">
                                                            序号</td>
                                                        <td class="dg_headerstyle">
                                                            姓名</td>
                                                        <td class="dg_headerstyle">
                                                            职称</td>
                                                        <td class="dg_headerstyle">
                                                            单位</td>
                                                        <td class="dg_headerstyle">
                                                            部门</td>
                                                        <td class="dg_headerstyle">
                                                            课题角色</td>
                                                    </tr>
                                                     <%  Set personSet = obj.getSubRes();  
                                                         if(personSet != null && personSet.size()>0){  
                                                   			Iterator iterPerson = personSet.iterator();
                                                   			int i = 0;
                                                   			while(iterPerson.hasNext()){
                                                   				
                                                   				SubRes person = (SubRes)iterPerson.next();
                                                   				if(null == person)
                                                   					continue;
                                                   				i++;
                                                   				
                                                    
                                                     %>
                                                    <tr class="dg_alternatingitemstyle">
                                                        <td align="center">
                                                           <%=i%></td>
                                                        <td>
                                                        
                                                            <%
                                                            	 if(person.getRes()!=null)
                                                            	
                                                            	out.print(person.getRes().getName()); %>
                                                        </td>
                                                        <td>
                                                            <%
	                                                                if(null != person.getRes()){
	                                                                	Researcher res = person.getRes();
	                                                                	if("1".equals(res.getZhicheng()))
	                                                                		 out.println("正高");
	                                                                	if("2".equals(res.getZhicheng()))
	                                                                		 out.println("副高");
	                                                                	if("3".equals(res.getZhicheng()))
	                                                                		 out.println("中级");
	                                                                	if("4".equals(res.getZhicheng()))
	                                                                		 out.println("初级");
	                                                                	if("5".equals(res.getZhicheng()))
	                                                                		 out.println("其它"); 
	                                                                }
                                                            
                                                            
                                                            %>
                                                        </td>
                                                        <td>
                                                            <%
                                                            if(person.getRes()!=null && person.getRes().getOrg()!=null)
                                                            
                                                           	out.println(person.getRes().getOrg().getName());
                                                           %>
                                                        </td>
                                                        <td>
                                                           <%
                                                           if(person.getRes()!=null && person.getRes().getDepartment()!=null)
                                                              out.println(person.getRes().getDepartment().getName());
                                                           %>
                                                        </td>
                                                        <td align="center">
                                                        <%
						                                  if(Constants.researcher_role_chargeman.equals(person.getResRole()+"")){
						                                  		out.println("负责人");
						                                  }
						                                   if(Constants.researcher_role_participant.equals(person.getResRole()+"")){
						                                  		out.println("参与人员");
						                                  }  %>
                                                             
                                                        </td>
                                                    </tr>
                                                    <%}}else{ %>
                                                    <tr class="dg_alternatingitemstyle">
                                                        <td align="center" colspan="6">
                                                        <font color=red>该课题当前没有人员信息</font>
                                                         </td> 
                                                    </tr>
                                                    <%} %>
                                                </table>
                                                
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                                 <!--- 标题 ---->
                                <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                    <tr>
                                        <td class="idt_tle_i">
                                            <img id="img1" src="<%=imagePath%>Themes/com/idt_tle_o.gif"></td>
                                        <td class="idt_tle_f1">相关文档</td>
                                    </tr>
                                </table>
                                <!--- 内容 --->
                                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                    <tr>
                                        <td>
                                            <div class="content">
                                                <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4">
                                                    <tr>
                                                        <td class="dg_headerstyle">
                                                            序号</td>
                                                             <td class="dg_headerstyle">
                                                            文档类型</td>
                                                        <td class="dg_headerstyle">
                                                            文档名称</td>
                                                       
                                                        <td class="dg_headerstyle">
                                                            上传时间</td>
                                                        <td class="dg_headerstyle">
                                                            上传人</td>
                                                        <td class="dg_headerstyle">
                                                            下载</td>
                                                    </tr>
                                                    <%   
                                                        if(docList != null && docList.size()>0){  
                                                   			Iterator iterAcc = docList.iterator();
                                                   			int i = 0;
                                                   			while(iterAcc.hasNext()){
                                                   				i++;
                                                   				Map rd = (Map)iterAcc.next();
                                                    
                                                     %>
                                                    <tr class="dg_alternatingitemstyle">
                                                        <td align="center" width="5%">
                                                            <%=i %></td>
                                                             <td align="center">
                                                             <%=rd.get("FILETYPE")==null?"":rd.get("FILETYPE")%>
                                                        </td>
                                                        <td>
                                                        <%if(fileAuth){ %>
                                                            <a href="<%=path %>/document.htm?action=downloadFile&fileId=<%=rd.get("ID")%>"><%= rd.get("FILENAME")%></a>
                                                            <%}else{ %>
                                                            <%= rd.get("FILENAME")%>
                                                            <%} %>
                                                        </td>
                                                       
                                                        <td align="center">
                                                             <%=Tools.getDateStringByDate((Date)rd.get("UPLOADDATE"))%>
                                                        </td>
                                                        <td>
                                                             <%= rd.get("UPLOADUSER")==null?"":rd.get("UPLOADUSER")%>
                                                        </td>
                                                        <td align="center">
                                                            <%if(fileAuth){ %> <a href="<%=path %>/document.htm?action=downloadFile&fileId=<%=rd.get("ID")%>">下载</a>
                                                            <%}else{ %>
                                                                          <a href="javaScript:download('<%=rd.get("ID")%>');">下载</a>
                                                            <%} %>
                                                        </td>
                                                    </tr>
                                                    <%}}else{ %>
                                                    <tr class="dg_alternatingitemstyle">
                                                        <td align="center" colspan="6">
                                                        <font color=red>该课题当前没有相关文档</font> 
                                                         </td>  
                                                    </tr>
                                                    <%} %>
                                                </table>
                                                
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                                <!--- 标题 ---->
                                <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                    <tr>
                                        <td class="idt_tle_i">
                                            <img id="img1" src="<%=imagePath%>Themes/com/idt_tle_o.gif"></td>
                                        <td class="idt_tle_f1">评审意见</td>
                                    </tr>
                                </table>
                                <!--- 内容 --->
                                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                    <tr>
                                        <td>
                                            <div class="content">
                                                <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4">
                                                    <tr>
                                                        <td class="dg_headerstyle">
                                                            序号</td>
                                                             <td class="dg_headerstyle">
                                                            评审类别</td>
                                                        <td class="dg_headerstyle">
                                                            评审人</td>
                                                             <td class="dg_headerstyle">
                                                            评审状态</td>
                                                        <td class="dg_headerstyle">
                                                            评审结果</td>
                                                        <td class="dg_headerstyle">
                                                            评审时间</td>
                                                         
                                                    </tr>
                                                    <%  Set expertSet = obj.getExpertSet();  
                                                         if(expertSet != null && expertSet.size()>0){  
                                                   			Iterator iterExpert = expertSet.iterator();
                                                   			int i = 0;
                                                   			while(iterExpert.hasNext()){
                                                   				i++;
                                                   				ResmanSubjectExpert expertRecord = (ResmanSubjectExpert)iterExpert.next();
                                                    
                                                     %>
                                                    <tr class="dg_alternatingitemstyle">
                                                        <td align="center">
                                                           <%=i%></td>
                                                        <td>
                                                            <%=expertRecord.getSyntype() %>
                                                        </td>
                                                        <td>
                                                            <%
                                                              if(expertRecord.getExpertUser() != null){ 
                                                            	  out.println(expertRecord.getExpertUser().getName());
                                                              }
                                                            %>
                                                        </td>
                                                         <td>
                                                         <% 
                                                             Long status = expertRecord.getAuditstatus();
								                                 if(status != null && 0 == status.intValue())
								                                    out.println("未评审");
								                                 else
								                                	 out.println("已评审");
								                                 %>
                                                         </td>
                                                        <td align="center"><font color="red">
                                                            <%
                                                            if(expertRecord.getExpertResult()!=null ){
                                                            	if("1".equals(expertRecord.getAuditstatus()+""))
                                                            			if("2".equals(expertRecord.getExpertResult()))
                                                            			     out.println("通过");
                                                            			else
                                                               			     out.println("未通过");
                                                            	         
                                                            	
                                                            }   
                                                            else
                                                            	out.println("&nbsp;");
                                                           %></font>
                                                        </td>
                                                        <td align="center">
                                                           <%=Tools.getDateStringByDate(expertRecord.getEndDate())%>
                                                        </td>
                                                         
                                                    </tr>
                                                    <%}}else{ %>
                                                    <tr class="dg_alternatingitemstyle">
                                                        <td align="center" colspan="6">
                                                        <font color=red>该课题当前没有评审信息</font>
                                                         </td> 
                                                    </tr>
                                                    <%} %>
                                                </table>
                                                
                                            </div>
                                        </td>
                                    </tr>
                                </table> 
                            </td>
                        </tr>
                    </table>
                </div> 
            </td>
        </tr>
    </table> 
</body>
</html>

